home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / xview / hview / procs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  2.6 KB  |  118 lines

  1. #include <stdio.h>
  2. #include <strings.h>
  3. #include <math.h>
  4. #include <sys/param.h>
  5. #include <sys/types.h>
  6. #include <xview/xview.h>
  7. #include <xview/panel.h>
  8. #include <xview/textsw.h>
  9. #include <xview/xv_xrect.h>
  10.  
  11. #include <X11/Xlib.h>
  12. #include <X11/Xutil.h>
  13. #include <xview/cms.h>
  14.  
  15. #include <hipl_format.h>
  16.  
  17. #include "hview_ui.h"
  18.  
  19. extern hview_win_objects *Hview_win;
  20. extern byte *image_data, *image_map, *image_map24;
  21. extern int width, height, im_size;
  22. extern XImage *ximage;
  23. extern int numcol;
  24. extern int depth;
  25.  
  26. extern Display *display;
  27. extern XID xid;
  28. extern Window mainw;
  29. extern Xv_Window paintwin;
  30.  
  31. extern int noglob, perfect, ncols, rwcolor, mono;
  32.  
  33. void      share_proc(), change_mode(), mono_proc();
  34.  
  35. /*************************************************************/
  36. void
  37. quit_proc(item, event)
  38.     Panel_item item;
  39.     Event    *event;
  40. {
  41.     FreeAllColors();
  42.  
  43.     xv_set(Hview_win->win, FRAME_NO_CONFIRM, TRUE, NULL);
  44.     (void) xv_destroy_safe(Hview_win->win);
  45. }
  46.  
  47. /*************************************************************/
  48. void
  49. hview_win_slider1_notify_callback(item, value, event)
  50.     Panel_item item;
  51.     int       value;
  52.     Event    *event;
  53. {
  54.     void      gamma_proc();
  55.  
  56.     gamma_proc(item, value, event);
  57. }
  58.  
  59. /*************************************************************/
  60. void
  61. make_perfect_colors(item, event)
  62.     Panel_item item;
  63.     Event    *event;
  64. {
  65.     perfect = abs(perfect - 1);    /* toggle color flash OK flag */
  66.  
  67.     if (perfect)
  68.     fprintf(stderr, "making perfect colormap \n");
  69.     else
  70.     fprintf(stderr, "making close colormap \n");
  71.  
  72.     make_new_colormap();
  73. }
  74.  
  75. /*************************************************************/
  76. make_new_colormap()
  77. {
  78.     FreeAllColors();
  79.  
  80.     if (rwcolor)
  81.     AllocRWColors(noglob, numcol, perfect, mono, ncols);
  82.     else
  83.     AllocColors(noglob, perfect, mono, numcol, ncols);
  84.  
  85.     /* remap image_map to color indexes */
  86.     map_image_to_colors(ximage->data, image_map, im_size);
  87.  
  88.     canvas_repaint_proc(Hview_win->can, paintwin, display, xid, NULL);
  89.  
  90.     fprintf(stderr, "Done. \n");
  91. }
  92.  
  93. /***********************************************************************/
  94. /*
  95.  * Event callback function for `win'.
  96.   */
  97. Notify_value
  98. hview_win_event_callback(win, event, arg, type)
  99.     Xv_window win;
  100.     Event    *event;
  101.     Notify_arg arg;
  102.     Notify_event_type type;
  103. {
  104.  
  105. #ifdef DEBUG
  106.     fprintf(stderr, "hview: hview_win_event_callback: event %d\n", event_id(event));
  107. #endif
  108.  
  109.     /* gxv_start_connections DO NOT EDIT THIS SECTION */
  110.  
  111.     if (event_action(event) == WIN_RESIZE) {
  112.     imgwin_resize_proc(win, event, arg, type);
  113.     }
  114.     /* gxv_end_connections */
  115.  
  116.     return notify_next_event_func(win, (Notify_event) event, arg, type);
  117. }
  118.